package com.lovo.homework;

public class Homework_7_8 {
    private Computer computer = new Computer();
    private Player player = new Player();

    public void run() {
        int time = 3;
        for (int i = 0; i < time; i++) {
            computer.choiceFist();
            player.choiceFist();
            if (computer.getFist() == player.getFist()) {
                System.out.println("平局！");
            } else if (player.getFist() == 0 && computer.getFist() == 1) {
                System.out.println("本轮你赢了！");
                player.setScore();
            } else if (player.getFist() == 1 && computer.getFist() == 2) {
                System.out.println("本轮你赢了！");
                player.setScore();
            } else if (player.getFist() == 2 && computer.getFist() == 0) {
                System.out.println("本轮你赢了！");
                player.setScore();
            } else {
                System.out.println("本轮你输了！");
                computer.setScore();
            }
        }
        if (computer.getScore() > player.getScore()) {
            System.out.println("电脑获得最终胜利！");
        } else {
            System.out.println("你获得最终胜利！");
        }
    }

    public static void main(String[] args) {
        Homework_7_8 test = new Homework_7_8();
        test.run();

    }
}
